package com.jt.www.domain.enums.pc;

/**
 * 营销角色
 *
 * @author lq
 * @create 2020-04-07 16:25
 */
public enum MarketerRoleEnum {
    ROLE_00("自行开发营销人员", "00"),
    ROLE_01("配给资源营销人员", "01"),
    ROLE_02("定向增员营销人员（组长）", "02"),
    ROLE_03("小组作业营销人员（组员）", "03");

    private String msg;
    private String code;

    MarketerRoleEnum(String msg, String code) {
        this.msg = msg;
        this.code = code;
    }

    public static String getMsgByCode(String code) {
        for (MarketerRoleEnum marketerRoleEnum : MarketerRoleEnum.values()) {
            if (marketerRoleEnum.code.equals(code)) {
                return marketerRoleEnum.msg;
            }
        }
        return "";
    }


    /**
     * 通过角色code 得到角色
     *
     * @param code
     * @return
     */
    public static MarketerRoleEnum getMarketerRoleEnumByCode(String code) {
        for (MarketerRoleEnum agreeStatusEnum : MarketerRoleEnum.values()) {
            if (agreeStatusEnum.code.equals(code)) {
                return agreeStatusEnum;
            }
        }
        //营销员没有配置角色  默认自行开发营销人员
        return MarketerRoleEnum.ROLE_00;
    }

    public String getMsg() {
        return msg;
    }

    public String getCode() {
        return code;
    }
}
